define([
    "app/controller/root",
	"oniui/mmRouter/mmState",
	"oniui/animation/avalon.animation"
	], function(root) {
    var rootVM = root;
    avalon.state("home", {
        url: "/",
        views: {
            "": {
                templateUrl: "../app/tpl/home.html",
                controllerUrl: "app/controller/home"
            }
        }
    }).state("library", {
        url: "/library",
        abstract: true,
        views: {
            "": {
                templateUrl: "../app/tpl/library.html",
                controllerUrl: "app/controller/library",
                
            }
        }
    }).state("library.list",{
        url: "",
        views: {
            "": {
                templateUrl: "../app/tpl/list.html",
                controllerUrl: "app/controller/lists"
            }
        }
    }).state("library.book", {
        url: "/{id}",
        views: {
            "": {
                templateUrl: "../app/tpl/book.html",
                controllerUrl: "app/controller/book"
            }
        }
    })
    .state("about", {
        url: "/about",
        views: {
            "": {
                templateUrl: "../app/tpl/about.html",
                controllerUrl: "app/controller/about",
            }
        }
    })

    avalon.state.config({
        onError: function() {
            avalon.log(arguments)
        }, // 强烈打开错误配置
        onLoad: function() {
            rootVM.menuAct = mmState.currentState.stateName.split(".")[0];
            var view = document.querySelector('[avalonctrl=' +rootVM.menuAct + ']');
            view && view.classList.add('animated');
            view && view.classList.add("fadeInUp");
            avalon.log(view);
        },
        onViewEnter: function(newNode, oldNode) {
  
        }

    })
    avalon.history.start({
        // basepath: "/mmRouter",
        fireAnchor: false
    })
    //go!!!!!!!!!
    avalon.scan()
})
